package com.cai.servlet.common.topic;

import com.cai.dao.DetailedTopicDao;
import com.cai.dao.impl.DetailedTopicDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author RuoLi
 * 根据选择栏章节匹配知识点
 */
@WebServlet(name = "ServletMatchSelectKnowledgePoint", value = "/common/MatchSelectKnowledgePoint")
public class ServletMatchSelectKnowledgePoint extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String chapterName = req.getParameter("chapter_name");
        DetailedTopicDao dao = new DetailedTopicDaoImpl();
        String data = dao.getMatchKnowledgePoint(chapterName);
        resp.getWriter().write(data);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
